package com.aaa.dem1103.d02;

/**
 * @Author: whj
 * @Version 1.0
 * @Date: 2022/11/3  9:59
 */
public class Test {
    public static void main(String[] args) {
        Swimming swimming = new Swimming(){
            @Override
            public void swiming() {
                System.out.println("*--*匿名内部类**--**");
            }
        };
        fun(swimming);


        Swimming s2=()->{
            System.out.println("lambda表达式============");
        };
        fun(s2);
    }
    //定义一个方法--->传递的参数为接口类型---函数式接口
    public static void fun(Swimming s){
        s.swiming();
    }
}

//该接口--->是函数式接口
@FunctionalInterface
interface Swimming{
    public void swiming();
}